<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <title>等你回家</title>
    <link href="<%=path%>/web/index/css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <script src="<%=path%>/web/index/js/jquery.min.js"></script>
    <link href="<%=path%>/web/index/css/style.css" rel="stylesheet" type="text/css" media="all" />


    <link href="<%=path%>/web/index/css/base.css" rel="stylesheet">
    <link href="<%=path%>/web/index/css/index.css" rel="stylesheet">
    <link href="<%=path%>/web/index/css/task.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=path%>/web/userinfo/css/page.css">



    <!-- /列表-->
</head>
<body style="background: #f7f7f7">
<!--header-->
<div class="banner-in">
    <div class="container">
        <h6>等你回家 / <span>任务列表</span></h6>
    </div>
</div>
<!--header-->
<div class="header">
    <div class="container">
        <div class="logo">
            <a href="index.html"><img src="<%=path %>/web/index/images/logo.png" alt=" " /></a>
        </div>
        <div class="top-nav">
            <span class="menu"> </span>
            <ul>
                <li  ><a href="<%=path %>/web/index" class="scroll">首页</a></li>
                <li><a href="<%=path %>/web/information/chooseType" class="scroll">你在哪儿</a></li>
                <li><a href="" class="scroll">我想回家</a></li>
                <li><a href="<%=path %>/web/blogger/blog" class="scroll">日志论坛</a></li>
                <li class="active"><a href="<%=path %>/web/task/releaseTask" class="scroll">任务列表</a></li>
                <c:if test="${empty(sessionScope.userinfo)}" var="result">
                    <li><a href="<%=path %>/web/userinfo/register" class="scroll">注册</a>|<a href="<%=path %>/web/userinfo/login" class="scroll">登录</a></li>
                </c:if>
                <c:if test="${not result}">
                    <li><a href="<%=path%>/web/userinfo/applyVolunteer" class="scroll">加入我们</a></li>
                    <c:if test="${(sessionScope.userinfo.username eq '')||(sessionScope.userinfo.username eq NULL)}" var="result">
                        <span style="color:white">欢迎<a href="<%=path %>/web/userinfo/index" style="color: white" href="">${sessionScope.userinfo.phone}</a></span>
                    </c:if>
                    <c:if test="${not result}">
                        <span style="color:white">欢迎<a href="<%=path %>/web/userinfo/index" style="color: white" href="">${sessionScope.userinfo.username}</a></span>
                    </c:if>
                    <span style="color: white">|</span>

                    <span style="color:white"><a style="color: white" href="<%=path %>/web/userinfo/logout">注销</a></span>
                    <span style="color: white">|</span>
                    <label><img style="width:30px;height: 30px" src="<%=path %>/web/uploadImages/${sessionScope.userinfo.pic}"></label>
                </c:if>
            </ul>
            <!--script-->
        </div>
        <div class="clearfix"> </div>
    </div>
</div>
<!---->
<!--content-->
<article>
    <h1 class="t_nav"><span>不要轻易放弃。学习成长的路上，我们长路漫漫，只因学无止境。 </span>
        <a href="#" class="n1 " data-id="0" >全部</a>
        <c:forEach items="${requestScope.marks}" var="mark">
            <a href="#" class="n1 n2" data-id="${mark.id}">${mark.title}</a>

        </c:forEach>

    </h1>

    <!-- 存放发布的任务列出来的div-->
    <div class="blogs">






    </div>
    <!-- /存放发布的任务列出来的div-->
    <div style="margin-left: 55px;"  class="col-md-3">
        <div class="store-right">
            <h6 class="Task"><a href="<%=path%>/web/task/publishTask">发布任务</a> </h6>

            <div class="dianzanss">
                <input name="keyboard" id="keyboard" class="Search" placeholder="请输入关键字"  type="text">
                <input name="show" value="title" type="hidden">
                <input name="tempid" value="1" type="hidden">
                <input name="tbname" value="news" type="hidden">
                <button name="Submit" id="Submit"  class="input_submit" >搜索</button>
            </div>

        </div>
        <div class="store-right">
            <h6>今日最热</h6>
            <ul class="store-men">
                <c:forEach begin="0" end="4" var="i">
                    <li><a href="${pageContext.request.contextPath}/web/task/details?id=${requestScope.tasks[i].id}"><span> </span>${requestScope.tasks[i].title}</a></li>
                </c:forEach>
            </ul>
        </div>
    </div>
</article>

<!--footer-->
<footer>
    <div class="footer" >
        <div class="container" >
            <p style="font-size: 15px;"><span style="font-size: 20px;">等你回家</span><span>邮箱:1111111@163.com</span>
                电话:0532—85025005</p>
            <p class="footer-class" style="font-size:15px;margin-top: -10px">地址:山东省青岛市市南区中联创意广场B1栋三楼 <a
                    href="http://w3layouts.com/" target="_blank">万码学堂</a></p>
            <p class="footer-class" style="font-size:15px;margin-top: -30px;text-transform: none">Copyright © 2019
                www.dengnihuijia.com All rights Reserved.</p>
        </div>
    </div>
</footer>
</body>
</html>

<script type="text/javascript">
   $(function(){
        stay(1);


      /* $(".blogs").on("click", "div.meneame a", function () { //给页码加点击事件
           var pageNum = $(this).data("id");
           initData(pageNum);
           return false;
       })*/


       $("#Submit").click(function () {//solar搜索
           var title = $("#keyboard").val();
           var pageNum=1;
           sousuoDate(pageNum,title);
           return false;
       })

       $(".blogs").on("click","div.solr a",function () {//solar搜索页面加点击事件
           var pageNum = $(this).data("id");
           var title = $("#keyboard").val();
           sousuoDate(pageNum,title);
           return false;
       })

       $(".blogs").on("click","div.Accept a",function () {//待接收已接收 搜索页面加点击事件
           var pageNum = $(this).html();
           var markId=$(this).data("id");
           stay(pageNum,markId);
           return false;
       })

       //待接受任务
       $(".t_nav a").click(function () {
            var id=$(this).data("id");

            $(this).parents().find("a").removeClass("n2");
            $(this).addClass("n2");
            stay(1,id);
            return false;
       });



   })

   function stay(pageNum,markId)
   {
       // console.log("页码="+pageNum+"markId="+markId);
       var data;
       if(markId==undefined)
       {
           data={pageNum:pageNum};
       }
       else
       {
           data={markId:markId,pageNum:pageNum};
       }
       var url="<%=path%>/web/task/stayAcceptAjax";
       $.post(url,data,function (data) {
           $(".blogs").html(data);
       });
   }

  /* function initData(pageNum) {
       var pageNum = {pageNum: pageNum};
       var url="/web/task/releaseTaskAjax";
       $.get(url,pageNum,function (mes) {
           $(".blogs").html(mes);
       })

   }*/

   /**
    * solr搜索初始化
    */
   function sousuoDate(pageNum,title) {//搜索页码加事件
       $.get("${pageContext.request.contextPath}/web/task/releaseTaskSolr", {
           pageNum: pageNum,
           title: title
       }, function (mes) {
           $(".blogs").empty();
           $(".blogs").html(mes);
       })

   }

</script>